﻿using LinqAndLambda.Modules;
using System;
using System.Collections.Generic;
using System.Linq;

namespace LinqAndLambda
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            #region Linq语法

            var nums = from num in numbers
                       where num % 2 == 0
                       select num;
            //偶数的个数
            int count = (from num in numbers
                         where num % 2 == 0
                         select num).Count();


            #endregion

            #region Lambda表达式

            var nums1 = numbers.Where(m => m % 2 == 0).Select(m => m);
            //偶数的个数
            var count1 = numbers.Where(m => m % 2 == 0).Select(m => m).Count();
            #endregion

            //foreach (var item in nums)
            //{
            //    Console.WriteLine(item);
            //}
            //Console.WriteLine("数量" + count);

            //Console.WriteLine("------------------------------------------");

            //foreach (var item in nums1)
            //{
            //    Console.WriteLine(item);
            //}
            //Console.WriteLine("数量" + count1);


            // 基本语法.Jiben();
            //Lef和多From子句.mian();
            //Join关键字.mian();
            //Linq方法之_Where_Count.mian();
            TaskDemo.mian();
            //TaskDemo.mian1();





            //Concat_Union_intersect.mian();

            Console.ReadLine();
        }




    }
}
